package com.newsproject.mapper;

import java.util.ArrayList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.newsproject.pojo.Category;
import com.newsproject.pojo.HotSearch;
import com.newsproject.pojo.Post;
import com.newsproject.pojo.Tag;
import com.newsproject.pojo.User;

@Mapper
public interface SearchMapper {
    // 搜索用户
    public ArrayList<User> searchUsers(@Param("username")String username);
    // 搜索新闻，可按类别，标签搜索
    public ArrayList<Post> searchNews(@Param("title")String title, @Param("category")int category);
    // 查找热搜词是否存在
    public HotSearch hasHotSearch(@Param("keyword")String keyword);
    // 获取热搜榜单,限制数量
    public ArrayList<HotSearch> getHotSearches(@Param("Num")int Num);
    // 分类ID是否存在
    public Category hasCategory(@Param("category_id")int category_id);
    // 标签ID是否存在
    public Tag hasTag(@Param("tag_id")int tag_id);
    // 根据新闻ID查询对应的新闻
    public Post getPostById(@Param("post_id")int post_id);
    // 获取今日热搜榜单
    public ArrayList<HotSearch> getTodayHotSearches(@Param("Num")int Num, @Param("today")String today);
}
